<?php
require_once('lib/gymnasium.php');
require_once('lib/gymhours.php');
require_once('lib/content.php');

$content1 = content_get_by_id('hours1');
$content2 = content_get_by_id('hours2');

echo '<h2>'.$content1['title'].'</h2>'.html_entity_decode($content1['text']);
?>

<table class="table-contain">
	<tr>
		<th>Catégorie</th>
		<?php
		$gyms = gym_get_list();
		while ($row = mysql_fetch_assoc($gyms)) {
			echo '<th><a href="gymnases-details-'.$row['id'].'.html" class="go">'.$row['name'].'</a></th>';
		}
		?>
	</tr>
	<?php
	$hours = hours_get_list();
	foreach ($hours as $hour) {
		$star = $hour[0] == 5 || $hour[0] == 6 ? ' (*)' : '';
		echo '
		<tr>
			<td>
				<strong>'.$hour[1].$star.'</strong><br />
				<em>Age</em> : '.$hour[2].'
			</td>';
			for ($i = 5; $i < count($hour); $i += 2) {
				if ($hour[$i + 1]) {
					echo '<td>'.$hour[$i + 1].'</td>';
				}
				else {
					echo '<td style="color: gray;"><em>Indisponible</em></td>';
				}
			}
		echo '
		</tr>';
	}
	?>
</table>

<?php echo html_entity_decode($content2['text']); ?>
